"""
订单相关模式
"""
from pydantic import BaseModel
from typing import Optional
from decimal import Decimal
from datetime import datetime
from .base import BaseSchema, TimestampMixin


class OrderBase(BaseModel):
    """订单基础模式"""
    order_no: str
    student_id: int
    course_id: int
    payment_method: Optional[str] = None
    registration_type: str = "新报名"
    should_pay_amount: Decimal
    actual_pay_amount: Decimal
    order_date: datetime
    sales_employee_id: Optional[int] = None
    reception_employee_id: Optional[int] = None
    customer_service_employee_id: Optional[int] = None
    performance_source: Optional[str] = None


class OrderCreate(OrderBase):
    """创建订单"""
    pass


class OrderUpdate(BaseModel):
    """更新订单"""
    payment_method: Optional[str] = None
    registration_type: Optional[str] = None
    should_pay_amount: Optional[Decimal] = None
    actual_pay_amount: Optional[Decimal] = None
    sales_employee_id: Optional[int] = None
    reception_employee_id: Optional[int] = None
    customer_service_employee_id: Optional[int] = None
    performance_source: Optional[str] = None
    status: Optional[str] = None


class OrderResponse(OrderBase, TimestampMixin, BaseSchema):
    """订单响应"""
    id: int
    status: str
